home *** CD-ROM | disk | FTP | other *** search
/ Aminet 37 / Aminet 37 (2000)(Schatztruhe)[!][Jun 2000].iso / Aminet / dev / lang / sofa.lha / sofa / smalleiffel / lib_show / number / example2.e < prev    next >
Text File  |  2000-03-25  |  2KB  |  49 lines

  1. -- This file is  free  software, which  comes  along  with  SmallEiffel. This
  2. -- software  is  distributed  in the hope that it will be useful, but WITHOUT
  3. -- ANY  WARRANTY;  without  even  the  implied warranty of MERCHANTABILITY or
  4. -- FITNESS  FOR A PARTICULAR PURPOSE. You can modify it as you want, provided
  5. -- this header is kept unaltered, and a notification of the changes is added.
  6. -- You  are  allowed  to  redistribute  it and sell it, alone or as a part of
  7. -- another product.
  8. --          Copyright (C) 1994-98 LORIA - UHP - CRIN - INRIA - FRANCE
  9. --            Dominique COLNET and Suzanne COLLIN - colnet@loria.fr
  10. --                       http://SmallEiffel.loria.fr
  11. --
  12. class EXAMPLE2
  13.    --
  14.    -- To start with NUMBERs, just compile an run it :
  15.    -- 
  16.    --            compile -o example2 -boost example2
  17.    --
  18.  
  19. inherit NUMBER_TOOLS;
  20.  
  21. creation make
  22.  
  23. feature
  24.  
  25.    make is
  26.       local
  27.          n1, n2, n3: NUMBER;
  28.       do
  29.          n1 := from_string("1/3");
  30.          n2 := from_integer(1) / from_integer(3);
  31.          n3 := n1 + n2;
  32.          io.put_number(n1);
  33.          io.put_string(" + ");
  34.          io.put_number(n2);
  35.          io.put_string(" = ");
  36.          io.put_number(n3);
  37.          io.put_new_line;
  38.          io.put_number(n1);
  39.          io.put_string(" + ");
  40.          io.put_number(n3);
  41.          io.put_string(" = ");
  42.          io.put_number(n1 + n3);
  43.          io.put_string("%NDo you like NUMBERs ?%N%
  44.                        %Have a look at example #3 to know more about NUMBERs%N");
  45.       end;
  46.  
  47. end -- EXAMPLE2
  48.  
  49.